function initValue(){
	var courseId=data.data.courseId;
	var json={
			courseId:courseId
	};
	$.get(CONTEXT_PATH+"class/ajaxListData", {
		data : JSON.stringify(json)
	} ,function(data) {
		if(data.status=="success"){
			var classList = $("select[id='classList']");
			classList.empty();
    		var s="";
    		var cs=data.data.list;
    		for(var i=0;i<cs.length;i++){
    			s+="<option value=\""+cs[i].id+"\">"+cs[i].name+"</option>";
    		}
    		classList.append(s);
		}else{
			alert(data.message);
		}
	}); 
	$.get(CONTEXT_PATH+"accontrol/ajaxListAssistant?id="+courseId,function(data) {
		if(data.status=="success"){
			var assistantList = $("select[id='assistantList']");
			assistantList.empty();
    		var s="";
    		var assistants=data.data.Assistants;
    		for(var i=0;i<assistants.length;i++){
    			s+="<option value=\""+assistants[i].id+"\">"+assistants[i].name+"</option>";
    		}
    		assistantList.append(s);
		}else{
			alert(data.message);
		}
	}); 
}

function selectTheory(value) {
	var selectedOption = value.options[value.selectedIndex];
	if(selectedOption.value == "err") {
		$(".theory_date_str").hide();
		$(".add-theory-time").hide();
		$(".theory_sum_week").hide();
		$("[class*='theory-start-']").remove();
		$("[class*='theory-end-']").remove();
		$("[class*='theory_location_']").remove();
	} else if(selectedOption.value == "1") {
		$(".theory_date_str").show();
		$(".add-theory-time").show();
		$(".theory_sum_week").show();
	} else if(selectedOption.value == "0") {
		$(".theory_date_str").hide();
		$(".add-theory-time").hide();
		$(".theory_sum_week").hide();
		$("[class*='theory-start-']").remove();
		$("[class*='theory-end-']").remove();
		$("[class*='theory_location_']").remove();
	}
}

function selectLab(value) {
	var selectedOption = value.options[value.selectedIndex];
	if(selectedOption.value == "err") {
		$(".lab_date_str").hide();
		$(".add-lab-time").hide();
		$(".lab_sum_week").hide();
		$("[class*='lab-start-']").remove();
		$("[class*='lab-end-']").remove();
		$("[class*='lab_location_']").remove();
	} else if(selectedOption.value == "1") {
		$(".lab_date_str").show();
		$(".add-lab-time").show();
		$(".lab_sum_week").show();
	} else if(selectedOption.value == "0") {
		$(".lab_date_str").hide();
		$(".add-lab-time").hide();
		$(".lab_sum_week").hide();
		$("[class*='lab-start-']").remove();
		$("[class*='lab-end-']").remove();
		$("[class*='lab_location_']").remove();
	}
}

function addtheoryTime() {
	$("[class*='theory-start-']").remove();
	$("[class*='theory-end-']").remove();
	$("[class*='theory_location_']").remove();
	
	var result = document.getElementById("theory_date_str").value;

	var list = $("#theory_date_list");

	for(var i = 1; i <= result; i++) {
		var str0 = "";
		var str = "";
		var str1 = "";
		
		str0 += ("<div class=\"form-group theory_location_" + i + "\">");
		str0 += ("<div class=\"row\"><div class=\"col-md-4\">");
		str0 += ("<label for = \"\" >理论课堂 ");
		str0 += (i);
		str0 += (" 上课地点</label></div>");
		str0 += ("<div class = \"col-md-6\" >");
		str0 += ("<input type=\"text\" class=\"form-control\" id=\"t-location");
		str0 += (i);
		str0 += ("\"></div></div></div>");

		str += ("<div class=\"form-group theory-start-time" + i + "\">");
		str += ("<div class=\"row\"><div class=\"col-md-4\">");
		str += ("<label for = \"\" >理论课堂 ");
		str += (i);
		str += (" 开始时间</label></div>");
		str += ("<div class = \"col-md-6\" >");
		str += ("<input type=\"datetime-local\" class=\"form-control t-time-start\" id=\"t-time-start");
		str += (i);
		str += ("\"></div></div></div>");

		str1 += ("<div class=\"form-group theory-end-time" + i + "\">");
		str1 += ("<div class=\"row\"><div class=\"col-md-4\">");
		str1 += ("<label for = \"\" >理论课堂 ");
		str1 += (i);
		str1 += (" 结束时间</label></div>");
		str1 += ("<div class = \"col-md-6\" >");
		str1 += ("<input type=\"datetime-local\" class=\"form-control t-time-end\" id=\"t-time-end");
		str1 += (i);
		str1 += ("\"></div></div></div>");
		
		list.append(str0);
		list.append(str);
		list.append(str1);
	}
}

function addlabTime() {
	$("[class*='lab-start-']").remove();
	$("[class*='lab-end-']").remove();
	$("[class*='lab_location_']").remove();

	var result = document.getElementById("lab_date_str").value;
	
	var list = $("#lab_date_list");

	for(var i = 1; i <= result; i++) {
		var str0 = "";
		var str = "";
		var str1 = "";
		
		str0 += ("<div class=\"form-group lab_location_" + i + "\">");
		str0 += ("<div class=\"row\"><div class=\"col-md-4\">");
		str0 += ("<label for = \"\" >实验课堂 ");
		str0 += (i);
		str0 += (" 上课地点</label></div>");
		str0 += ("<div class = \"col-md-6\" >");
		str0 += ("<input type=\"text\" class=\"form-control\" id=\"l-location");
		str0 += (i);
		str0 += ("\"></div></div></div>");

		str += ("<div class=\"form-group lab-start-time" + i + "\">");
		str += ("<div class=\"row\"><div class=\"col-md-4\">");
		str += ("<label for = \"\" >实验课堂 ");
		str += (i);
		str += (" 开始时间</label></div>");
		str += ("<div class = \"col-md-6\" >");
		str += ("<input type=\"datetime-local\" class=\"form-control l-time-start\" id=\"l-time-start");
		str += (i);
		str += ("\"></div></div></div>");

		str1 += ("<div class=\"form-group lab-end-time" + i + "\">");
		str1 += ("<div class=\"row\"><div class=\"col-md-4\">");
		str1 += ("<label for = \"\" >实验课堂 ");
		str1 += (i);
		str1 += (" 结束时间</label></div>");
		str1 += ("<div class = \"col-md-6\" >");
		str1 += ("<input type=\"datetime-local\" class=\"form-control l-time-end\" id=\"l-time-end");
		str1 += (i);
		str1 += ("\"></div></div></div>");

		list.append(str0);
		list.append(str);
		list.append(str1);
	}
	
}

